package com.blb.day20231107login.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blb.day20231107login.entity.Permission;
import com.blb.day20231107login.entity.Role;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenheng
 * @since 2023-11-06
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    List<Permission> selectPermissionsWithChildren();

    /**
     * 根据角色id查询权限id集合
     * @param roleId
     * @return
     */
    @Select("select permission_id from role_permission where role_id = #{roleId}")
    List<Long> selectPermissionIdsByRoleId(Long roleId);
}
